function myRegister(){
	var tel=$("#tel").val()
	if(validUname()&&validPwdOk()&&validPwd()&&validTel()&&validAfter()&&repeatTel(tel)){
		login()
	}
}
function login(){
	$.ajax({
		url:"http://localhost:8080/user/register",
		data:$("#form1").serialize(),
		type:"post",
		dataType:"json",
		async:false,
		success:function(data){
			
			getList=data.data
			if(data.status==1){
				$.DialogByZ.Autofade({Content: "注册成功3秒将跳转到登陆页"})
				setInterval("changePage()",3000)
			}
			
		}
	})
}
function changePage(){
	location.href="login.htm"
}
function validAfter(){
		var pwd=$("#pwd").val()
		var pwdOk=$("#pwdOk").val()
		if(pwd==pwdOk){
			return true
			
		}else{
			
			$.DialogByZ.Alert({Title: "提示", Content:"两次密码不一致",BtnL:"确定"})
			return false
		}
}
function repeatTel(tel){
	validTel()
	var flag=false
		$.ajax({
		url:"http://localhost:8080/user/findTel",
		data:{"tel":tel},
		type:"post",
		dataType:"json",
		async:false,
		success:function(data){
			if(data.status==1){
				flag=true
			}else{
				
				$.DialogByZ.Alert({Title: "提示", Content:data.msg,BtnL:"确定"})
				flag=false
			}
		
		}
	})
	return flag
}
function validPwd(){
	var pwd=$("#pwd").val()
	var reg=/^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,20}$/

	if(reg.test(pwd)){
		return true
	}else{
		$.DialogByZ.Alert({Title: "提示", Content:"密码不合法",BtnL:"确定"})
		return false
	}
}
function validUname(){
	var uName=$("#uName").val()
	if(uName){
		return true
	}else{
		
		$.DialogByZ.Alert({Title: "提示", Content:"用户名不用为空",BtnL:"确定"})
		return false 
	}
}	
function validPwdOk(){
	var pwdOk=$("#pwdOk").val()
	var reg=/^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,20}$/
	if(reg.test(pwdOk)){
		return true
	}else{
		
		$.DialogByZ.Alert({Title: "提示", Content:"密码不合法",BtnL:"确定"})
		return false
	}
}

function validTel(){
	var reg=/^[1][3,4,5,6,7,8,9][0-9]{9}$/
	var tel=$("#tel").val()

	if(reg.test(tel)){
		return true
	}else{
		
		$.DialogByZ.Alert({Title: "提示", Content:"手机号不合法",BtnL:"确定"})
		return false
	}
}